<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>企业管理系统</title>
<meta name="renderer" content="webkit"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <link rel="stylesheet" href="layui/css/layui.css" media="all"/>
    <script src="layui/layui.js"></script>
    <!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<script src="js/ajax.js"></script>
  <script>
    //依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;
    });
    function close() {
		if(confirm("您确定要退出登录？")) {
			$.ajax({
				url:"Sp/outlogin",
				type:"post",
				success:function(){
				},
				error:function(){
				}
			})
			window.location.href="/";
		} else {}
	}
</script>
  <link rel="stylesheet" href="/layui/a.css"  media="all"/>
  <link rel="stylesheet" href="/layui/b.css" media="all"/>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div style="background-image: url('/image/toubu2.jpg'); background-size:100% 100% ; background-attachment: fixed;" class="layui-header header header-demo">
  <div class="layui-main">
  <label class="layui-label" style="font-size: 30px;color: white;margin-top: 15px;position: absolute;font-family:华文行楷;">HD海德塑业</label>
    <label class="layui-label" style="position: absolute; left: 40%; margin-top: 10px;font-size: 25px;font-family:STSong;color:white">广西海德企业管理系统</label>
    <ul class="layui-nav">
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-print"></i><span id="printcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="printstatus" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a id="layui-spm-event-aliyun">未打印货单<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-notice"></i><span id="yjcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="zyj" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a target="_blank" id="layui-spm-event-aliyun">发货货单逾期告警<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
      <li class="layui-nav-item">
        <a id="quxianname" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
        <a id="username" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
      </li>
      <li class="layui-nav-item layui-hide-xs">
        <a href="javascript:close();" style="font-size: 18px;">退出登录</span></a>
      </li>
    </ul>
  </div>
</div>
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      
<ul class="layui-nav layui-nav-tree site-demo-nav">
  
  <li id="mate" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">原料系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/addmate.html">原料制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd>
        <a style="margin-left: 22px;" href="/matecon.html">原料管理</a>
      </dd>
    </dl>
  </li>
  
  <li id="sell" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">货单系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/addsell.html">货单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/sellcon.html">货单管理</a>
      </dd>
    </dl>
    <dl id='fd' class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/sellcon2.html">废单管理</a>
      </dd>
    </dl>
  </li>
  <li id="stock" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">库单系统</a>
    <dl id="stock1" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stock.html">库单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockGL.html">库单管理</a>
      </dd>
    </dl>
    <dl id="kcxh" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockXH.html">库单型号</a>
      </dd>
    </dl>
  </li>
  <li id="pay" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">货款系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="paycom.html">货款制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd id="paycon">
        <a style="margin-left: 22px;" href="paycomGL.html">货款管理</a>
      </dd>
    </dl>
  </li>
  <li id="exin" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">资金系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="income.html">
          收入制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeGL.html">
          收入管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expend.html">
          支出制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendGL.html">
          支出管理
        </a>
      </dd>
    </dl>
  </li>
  <li id="tj" class="layui-nav-item layui-nav-itemed">
    <a class="javascript:;" href="javascript:;">统计报表</a>
    <dl id="yl" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="yuanliaoTJ.html">
          原料统计
        </a>
      </dd>
    </dl>
    <dl id="hd" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="huodanTJ.html">
          货单统计
        </a>
      </dd>
    </dl>
    <dl id="sr" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeTJ.html">
          收入统计
        </a>
      </dd>
    </dl>
    <dl id="zc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendTJ.html">
          支出统计
        </a>
      </dd>
    </dl>
    <dl id="qk" class="layui-nav-child">
      <dd class="layui-this">
        <a style="margin-left: 22px;" href="qiankuanTJ.html">
          欠款统计
        </a>
      </dd>
    </dl>
    <dl id="kc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="kucunTJ.html">
          库单统计
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">客户信息</a>
    <dl id="addshopper" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/shopper.html">
          添加客户
        </a>
      </dd>
    </dl>
    <dl id="shopper" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/shopperGL.html">
          客户管理
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">账号</a>
    <dl id="adduser" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/user.html">
          添加账号
        </a>
      </dd>
    </dl>
    <dl id="user" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/userGL.html">
          账号管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="updatepawod.html">
          修改密码
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="javascript:close();">
          注销
        </a>
      </dd>
    </dl>
  </li>
  
  <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
</ul>

    </div>
  </div>
  <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
    <div class="layui-body layui-tab-content site-demo site-demo-body">
    
    
      <div class="layui-tab-item layui-show">
        <div class="layui-main">
          <div id="LAY_preview">
              
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>欠款统计</legend>
</fieldset>
 <script>

function change(){
    var select=document.getElementById("odd").value;
    $.ajax({
		url:"Sp/seleoddbytotal",
		data:{"odd":select},
		type:"post",
		dataType:"",
		success:function(a){
			document.getElementById("total").value=a.total;
			document.getElementById("debt").value=a.money;
		},
		error:function(){
			layer.msg("发生异常");
		}
	})
}
</script>
<form class="layui-form" action="javascript:0;">
		<div style="display: none;" class="layui-form-item">
		<input type="hidden" value="1" name="status">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">货物名称</span>
				<div class="layui-inline">
					<input class="layui-input" name="name" id="compname" autocomplete="off" placeholder="请输入货物名称">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">订单去name="odd"</span>
				<div class="layui-inline">
					<input class="layui-input" id="grade" autocomplete="off" placeholder="请输入订单">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">型号</span>
				<div class="layui-inline">
					<input class="layui-input" name="modele" id="grade" autocomplete="off" placeholder="请输入型号">
				</div>
		</div>
		<div class="layui-form-item">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">订单</span>
				<div class="layui-inline">
					<input class="layui-input" name="odd" id="grade" autocomplete="off" placeholder="请输入订单">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">收货人名字</span>
				<div class="layui-inline">
				      <select id="name2" name="name2" lay-filter="name2" lay-search>
				      </select>
					<!-- <input class="layui-input" name="name2" id="name2" autocomplete="off" placeholder="请输入收货名字"> -->
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">收货地址</span>
				<div class="layui-inline">
					<input class="layui-input" name="site" id="site" autocomplete="off" placeholder="请输入收货地址">
				</div>
		</div>
		<div class="layui-form-item">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">销售人员</span>
				<div class="layui-inline">
					<input class="layui-input" name="anq" id="anq" autocomplete="off" placeholder="请输入销售人员">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">发货时间段</span>
				<div class="layui-inline">
					<input class="layui-input" name="time" id="test6" autocomplete="off" placeholder=" - ">
				</div>
			<div class="layui-inline">
				<div class="layui-input-inline">
					<button class="layui-btn" id="searchBtn" lay-submit
						lay-filter="demo1" style="margin-left: 15px">
						<i class="layui-icon layui-icon-search"></i> 查询
					</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</div>
	</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<div style="float: right;"><p id="total" style="font-size: 20px;"></p></div>
<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">
  </div>
</script>
 
<div id="barDemo" style="display: none;">
  <a id='uptable' class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</div>
<script type="text/html" id="imgtemp">
	<div><a href="{{d.tupian}}" target="_blank"><img src="{{d.tupian}}" class="layui-nav-img" style="width:20px;height:20px"></a></div>
</script>
<script type="text/html" id="text">
	<div><label>{{d.quantite*d.money}}</label></div>
</script>
  </div>
  </div>
  </div>
  </div>
  </div>
  <div class="layui-footer footer footer-demo">
  <div class="layui-main">
    <p>
      Build By 广西海德塑料有限责任公司
    </p>
  </div>
</div>
</div>
<div id="LAY_democodejs">
<script>
layui.use(['table','form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  var strcookie = document.cookie;//获取cookie字符串 
      var arrcookie = strcookie.split("; ");//分割 
      //遍历匹配 
      for ( var i = 0; i < arrcookie.length; i++) { 
	  console.log(arrcookie[i]); 
          var arr = arrcookie[i].split("="); 
          if (arr[0] == "username"){ 
  		document.getElementById("username").innerHTML=arr[1];
          } 
      } 
　　if(document.getElementById("username").innerHTML.indexOf("销售")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("paycon").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("stock").style.display="none";  
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
}
	if(document.getElementById("username").innerHTML.indexOf("制单")!=-1){
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("hd").style.display="none";
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("uptable").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("生产")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("sell").style.display="none"; 
		document.getElementById("pay").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("qk").style.display="none"; 
		document.getElementById("hd").style.display="none";  
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("alldele").style.display="none";
		document.getElementById("uptable").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("超")==-1){
		document.getElementById("kcxh").style.display="none"; 
		document.getElementById("uptable").style.display="none"; 
	}
	$.ajax({
		url:"seleoddalltime",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("yjcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#zyj')
			var str="<dd lay-unselect> <a id='yj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('yj'+i).innerHTML=a.str[i];	
		}			
		},
		error:function(){
			console.log("逾期告警发生异常");
			
		}
	})
	$.ajax({
		url:"Sp/seleprintstatus",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("printcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#printstatus')
			var str="<dd lay-unselect> <a id='dyyj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('dyyj'+i).innerHTML=a.string[i];	
		}			
		},
		error:function(){
			console.log("打印告警发生异常");
		}
	})
  var table = layui.table;
  
  //日期
  laydate.render({
    elem: '#date',
    type: 'datetime'
  });

  //获取客户select
   $.ajax({
 		url:"Sp/seleallshopper",
 		type:"post",
 		dataType:"",
 		success:function(btn){
 	          var select = $("#name2");//TypeID为HTML标签ID
 	         select.append("<option value=''>全部</option>");
 		      	for (var j = 0; j < btn.count; j++) {
 			      	  select.append("<option value='"+btn.data[j].name+"'>"+btn.data[j].name+':'+btn.data[j].phone+"</option>");
 		  		}
 	          layui.form.render("select");
 		},
 		error:function(){
 			layer.msg("客户获取失败");
 		}
 	})
//获取odd select
  $.ajax({
		url:"Sp/seleallodd",
		type:"post",
		dataType:"",
		success:function(btn){
	          var select = $("#odd");//TypeID为HTML标签ID
		      	for (var j = 0; j < btn.count; j++) {
		      	  select.append("<option onclick='change()' value='"+btn.data[j]+"'>"+btn.data[j]+"</option>");
		  		}
	          layui.form.render("select");
		},
		error:function(){
			layer.msg("发生异常");
		}
	})
	var tableinfo=table.render({
	    elem: '#test'
	    ,url:'/Sp/seleoddtj'
            ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
                ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                  title: '提示'
                  ,layEvent: 'LAYTABLE_TIPS'
                  ,icon: 'layui-icon-tips'
                }]
                ,title: '数据表'
                ,cols: [[
  	                //,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
  	                {field:'odd', title:'单号', width:'5%', sort: true}
  	                ,{field:'name2', title:'收货人名字', width:'8%'}
  	                ,{field:'phone', title:'收货人电话', width:'10%'}
  	                ,{field:'site', title:'收货人地址', width:'20%'}
  	                ,{field:'time', title:'发货时间', width:'15%'}
  	                ,{field:'total', title:'本单金额',width:'10%', sort: true}
  	                ,{field:'debt', title:'欠款金额', width:'10%'}
  	                ,{field:'anq', title:'销售人员', width:'8%'}
  	                ,{field:'tupian', title: '图片', width:'7%',templet:'#imgtemp'}
	              ]]
		,done: function (res, curr, count){
		  $('table').css('width', '100%');//这里设置表格的宽度为100%
	         //var select = "投资总金额："+btn.totalTz+"</br>货款总金额："+btn.totalHk;
	         var select = "总欠款："+res.debt;
	         document.getElementById("total").innerHTML=select;
		  }
	    ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
	      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
  	  	  ,limit: 5 //每页默认显示的数量
	      ,groups: 15 //只显示 1 个连续页码
	      , prev: '上一页'                 //上一页文本
	      , next: '下一页'                 //下一页文本
	      ,first: false //不显示首页
	      ,last: '尾页', //不显示尾页
	          request : {
	              page : 'pageNum', // 页码的参数名称，默认：page
	              limit : 'pageSize' // 每页数据量的参数名，默认：limit
	          }
	    },
	    limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
	    id:'table'
	});

 /*  $.ajax({
		url:"Sp/billtotal",
		type:"post",
		dataType:"",
		success:function(btn){
	         //var select = "投资总金额："+btn.totalTz+"</br>货款总金额："+btn.totalHk;
	         var select = "总欠款："+btn.debt;
	         document.getElementById("total").innerHTML=select;
		},
		error:function(){
			layer.msg("统计获取失败");
		}
	}) */
		
  form.on('submit(demo1)', function(data){
	  tableinfo=table.render({
			    elem: '#test'
			    ,url:'Sp/seleoddsearch'
			    ,type:"post"
			    ,where:data.field
			    ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
			    ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
			      title: '提示'
			      ,layEvent: 'LAYTABLE_TIPS'
			      ,icon: 'layui-icon-tips'
			    }]
		  		,title: '数据表'
			    ,cols: [[
		  	                //,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
		  	                {field:'odd', title:'单号', width:'5%', sort: true}
		  	                ,{field:'name2', title:'收货人名字', width:'8%'}
		  	                ,{field:'phone', title:'收货人电话', width:'10%'}
		  	                ,{field:'site', title:'收货人地址', width:'20%'}
		  	                ,{field:'time', title:'发货时间', width:'15%'}
		  	                ,{field:'total', title:'本单金额',width:'10%', sort: true}
		  	                ,{field:'debt', title:'欠款金额', width:'10%'}
		  	                ,{field:'anq', title:'销售人员', width:'8%'}
		  	                ,{field:'tupian', title: '图片', width:'7%',templet:'#imgtemp'}
			              ]]
			 	 ,done: function (res, curr, count){
				  $('table').css('width', '100%');//这里设置表格的宽度为100%
			         //var select = "投资总金额："+btn.totalTz+"</br>货款总金额："+btn.totalHk;
			         var select = "总欠款："+res.debt;
			         document.getElementById("total").innerHTML=select;
				  }
			    ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
			      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
			      //,curr: 5 //设定初始在第 5 页
			      ,groups: 15 //只显示 1 个连续页码
			      , prev: '上一页'                 //上一页文本
			      , next: '下一页'                 //下一页文本
			      ,first: false //不显示首页
			      ,last: '尾页', //不显示尾页
			          request : {
			              page : 'pageNum', // 页码的参数名称，默认：page
			              limit : 'pageSize' // 每页数据量的参数名，默认：limit
			          }
			    },
			    limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
			    id:'table'
			  });

	   /*  $.ajax({
	 		url:"Sp/qiankuantotal",
	 		type:"post",
	 		data:data.field,
	 		dataType:"",
	 		success:function(btn){
		         //var select = "投资总金额："+btn.totalTz+"</br>货款总金额："+btn.totalHk;
		         var select = "总欠款："+btn.debt;
	 	         document.getElementById("total").innerHTML=select;
	 		},
	 		error:function(){
	 			layer.msg("统计获取失败");
	 		}
	 	}) */
 }); 
		
		
	  //头工具栏事件
	  table.on('toolbar(test)', function(obj){
	    var checkStatus = table.checkStatus(obj.config.id);
	    switch(obj.event){
	      case 'getCheckData':
	        var data = checkStatus.data;
	        layer.alert(JSON.stringify(data));
	      break;
	      case 'getCheckLength':
	        var data = checkStatus.data;
	        layer.msg('选中了：'+ data.length + ' 个');
	      break;
	      case 'isAll':
	          layer.msg(checkStatus.isAll ? '全选': '未全选');
	        break;
	      //自定义头工具栏右侧图标 - 提示
	      case 'LAYTABLE_TIPS':
	        layer.alert('这是工具栏右侧自定义的一个图标按钮');
	      break;
	    };
	  });
	  $(document).on('click',"#oddinfo",function(){
		var str = document.getElementById("odd").value;
		  table.render({
              elem: '#test'
              ,url:'/Sp/seleodd'
              ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
              ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                ,layEvent: 'LAYTABLE_TIPS'
                ,icon: 'layui-icon-tips'
              }]
              ,title: '数据表'
              ,cols: [[
	                //,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
	                {field:'odd', title:'单号', width:'5%', sort: true}
	                ,{field:'name2', title:'收货人名字', width:'8%'}
	                ,{field:'phone', title:'收货人电话', width:'10%'}
	                ,{field:'site', title:'收货人地址', width:'20%'}
	                ,{field:'time', title:'发货时间', width:'15%'}
	                ,{field:'total', title:'本单金额',width:'10%', sort: true}
	                ,{field:'debt', title:'欠款金额', width:'10%'}
	                ,{field:'anq', title:'销售人员', width:'8%'}
	                ,{field:'tupian', title: '图片', width:'7%',templet:'#imgtemp'}
	              ]]
		  		,done: function (res, curr, count){
			  $('table').css('width', '100%');
			  //这里设置表格的宽度为100%
			  }
              ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                //,curr: 5 //设定初始在第 5 页
                ,groups: 15 //只显示 1 个连续页码
                , prev: '上一页'                 //上一页文本
                , next: '下一页'                 //下一页文本
                ,first: false //不显示首页
                ,last: '尾页', //不显示尾页
                    request : {
                        page : 'pageNum', // 页码的参数名称，默认：page
                        limit : 'pageSize' // 每页数据量的参数名，默认：limit
                    }
              },
              limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
              id:'table'
            });
	  });
	  $(document).on('click',"#billinfo",function(){
		  
		var str = document.getElementById("odd").value;
		  table.render({
              elem: '#test'
              ,url:'/Sp/billinfo?odd='+str
              ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
              ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                ,layEvent: 'LAYTABLE_TIPS'
                ,icon: 'layui-icon-tips'
              }]
              ,title: '数据表'
              ,cols: [[
                //{type: 'checkbox', fixed: 'left'}
                //,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
                {field:'odd', title:'单号', width:100, sort: true}
                ,{field:'money', title:'已交金额', width:100}// ,edit: 'text'单元格编辑
                ,{field:'total', title:'应收金额', width:100}
                /* ,{field:'debt', title:'欠款', width:120, } */
                ,{field:'time', title:'还款时间', width:220, }
                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:120}
              ]]
		  		,done: function (res, curr, count){
			  $('table').css('width', '100%');
			  //这里设置表格的宽度为100%
			  }
              ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                //,curr: 5 //设定初始在第 5 页
                ,groups: 15 //只显示 1 个连续页码
                , prev: '上一页'                 //上一页文本
                , next: '下一页'                 //下一页文本
                ,first: false //不显示首页
                ,last: '尾页', //不显示尾页
                    request : {
                        page : 'pageNum', // 页码的参数名称，默认：page
                        limit : 'pageSize' // 每页数据量的参数名，默认：limit
                    }
              },
              limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
              id:'table'
            });
		    /* $.ajax({
		 		url:"Sp/billtotal",
		 		type:"post",
		 		dataType:"",
		 		success:function(btn){
			         //var select = "投资总金额："+btn.totalTz+"</br>货款总金额："+btn.totalHk;
			         var select = "总欠款："+btn.debt;
		 	         document.getElementById("total").innerHTML=select;
		 		},
		 		error:function(){
		 			layer.msg("统计获取失败");
		 		}
		 	}) */
	  });
	  //监听行工具事件
	  table.on('tool(test)', function(obj){
	    var data = obj.data;
	    var id = obj.data.id;
	    var cid = obj.data.cid;
	    console.log(obj);
	    if(obj.event === 'del'){
			layer.confirm('确定的删除该行', function(index){
				$.ajax({
	 				url:"Sp/delebillbyid",
	 				type:"get",
	 				data:{"id":id},
	 				success:function(a){
	 					//alert(a.result);
	 			        obj.del();					
	 				},
	 				error:function(){
	 					layer.msg("发生异常");
	 				}
	 			})  
	        layer.close(index);
	      });
	    } else if(obj.event === 'edit'){
	    	window.location.href="/addsell.html?"+id;
	    }
	  });
	});
</script>
</div>
</body>
</html>